package com.j2data.spike.rabbitmq;

import com.j2data.spike.pojo.SpikeMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @author j2data
 * @version 1.0
 */
@Service
@Slf4j
public class MQSender {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     * 发送秒杀消息
     * @param message
     */
    public void sendSpikeMessage(String message){
        log.info("发送消息:"+message);
        rabbitTemplate.convertAndSend("spikeExchange", "spike.message",message);
    }
}
